package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.ChatMessagesMapper;
import com.hello.system.domain.ChatMessages;
import com.hello.system.service.IChatMessagesService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 聊天消息记录Service业务层处理
 * 
 * @author hello
 * @date 2025-05-15
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class ChatMessagesServiceImpl extends ServiceImpl<ChatMessagesMapper, ChatMessages> implements IChatMessagesService 
{
    private final ChatMessagesMapper chatMessagesMapper;

    /**
     * 查询聊天消息记录
     * 
     * @param messageId 聊天消息记录主键
     * @return 聊天消息记录
     */
    @Override
    public ChatMessages selectChatMessagesByMessageId(Long messageId)
    {
        return chatMessagesMapper.selectChatMessagesByMessageId(messageId);
    }

    /**
     * 查询聊天消息记录列表
     * 
     * @param chatMessages 聊天消息记录
     * @return 聊天消息记录
     */
    @Override
    public List<ChatMessages> selectChatMessagesList(ChatMessages chatMessages)
    {
        return chatMessagesMapper.selectChatMessagesList(chatMessages);
    }

    /**
     * 新增聊天消息记录
     * 
     * @param chatMessages 聊天消息记录
     * @return 结果
     */
    @Override
    public int insertChatMessages(ChatMessages chatMessages)
    {
        chatMessages.setCreateTime(DateUtils.getNowDate());
        return chatMessagesMapper.insertChatMessages(chatMessages);
    }

    /**
     * 修改聊天消息记录
     * 
     * @param chatMessages 聊天消息记录
     * @return 结果
     */
    @Override
    public int updateChatMessages(ChatMessages chatMessages)
    {
        chatMessages.setUpdateTime(DateUtils.getNowDate());
        return chatMessagesMapper.updateChatMessages(chatMessages);
    }


    /**
     * 批量删除聊天消息记录
     * 
     * @param messageIds 需要删除的聊天消息记录主键
     * @return 结果
     */
    @Override
    public int deleteChatMessagesByMessageIds(Long[] messageIds)
    {
        return chatMessagesMapper.deleteChatMessagesByMessageIds(messageIds);
    }

    /**
     * 删除聊天消息记录信息
     * 
     * @param messageId 聊天消息记录主键
     * @return 结果
     */
    @Override
    public int deleteChatMessagesByMessageId(Long messageId)
    {
        return chatMessagesMapper.deleteChatMessagesByMessageId(messageId);
    }
}
